<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>我是子应用</title>
  <style>
    .root {
      width: 500px;
      height: 400px;
      background-color: royalblue;
      color: #fff;
    }

    .btn {
      color: blue;
    }
  </style>
</head>

<body>
  <div id="root" class="root">
    <button id="btn" class="btn">changeColor</button>
  </div>
  <script>

    const btn = document.querySelector('#btn')
    const root = document.querySelector('#root')
    btn.addEventListener('click', () => {
      root.style.backgroundColor = 'pink'
    })

    // 补充俩个生命周期函数
    function mount () {
      console.log('子应用完成加载了')
    }

    function unMount () {
      console.log('子应用完成卸载了')
    }



    // 挂载到window对象上
    window.__qiankunMount = mount
    window.__qiankunUnMount = unMount

  </script>
</body>

</html>